<template>
    <div>
        <h1>事务提醒</h1>
        <a-table :columns="columns" :data-source="data" :pagination="{ 'show-quick-jumper': true, 'show-size-changer': true }">
            <span slot="type" slot-scope="type">{{typeText[type]}}</span>
            <span slot="date" slot-scope="date">{{date.getFullYear()}}-{{date.getMonth()+1}}-{{date.getDate()}}</span>
        </a-table>
        <div style="height: 20px;"></div>
    </div>
</template>

<script>
    export default {
        name: "Todo",
        data: () => ({
            typeText: [ '', '仓管', '档案', '设备', '活动' ],
            columns: [
                {
                    title: '序号',
                    dataIndex: 'index',
                    key: 'index',
                },
                {
                    title: '标题',
                    dataIndex: 'text',
                    key: 'text',
                },
                {
                    title: '来源',
                    dataIndex: 'type',
                    key: 'type',
                    scopedSlots: { customRender: 'type' },
                },
                {
                    title: '提醒日期',
                    dataIndex: 'date',
                    key: 'date',
                    scopedSlots: { customRender: 'date' },
                },
            ],
            data: [
                {
                    key: 1,
                    index: 1,
                    text: '事务一',
                    type: 1,
                    date: new Date(),
                },
                {
                    key: 2,
                    index: 2,
                    text: '事务二',
                    type: 2,
                    date: new Date(),
                },
            ],
        }),
        beforeRouteEnter(to, from, next) {
            next(vm => {
                vm.$emit('route');
            });
        }
    }
</script>

<style scoped>

</style>
